sink.Main.offlinestore = new Ext.data.Store({
    model: 'Photo',
    proxy: {
        type: 'ajax',
        id: 'demos',
        reader: new Ext.data.JsonReader({
            root: 'query.results.photo'
        }),
    },
    data: [
       	{"id":"6131204391", "owner":"53293475@N07", "secret":"461901d233", "server":"6199", "farm":7, "title":"Who says octogenarians can't be awed?", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6104106869", "owner":"76153932@N00", "secret":"2e0a678227", "server":"6194", "farm":7, "title":"After a long, exhausting climb and a lot of puffing and sweating we arrive at the top of the hill at 800 meters", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6082443835", "owner":"45153865@N08", "secret":"fe0ce5329f", "server":"6191", "farm":7, "title":"Airborne", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6077252638", "owner":"53631132@N04", "secret":"9f3970205f", "server":"6087", "farm":7, "title":"Age", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6071888217", "owner":"31756530@N08", "secret":"e85124a20f", "server":"6067", "farm":7, "title":"Lindsey - 909 & Catti LaBelle - 808", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6057630550", "owner":"41894148105@N01", "secret":"c940593afc", "server":"6077", "farm":7, "title":"Steve & Cec", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6028272154", "owner":"38332364@N00", "secret":"9f0ff5fa95", "server":"6205", "farm":7, "title":"P1060392", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6024556737", "owner":"7428687@N03", "secret":"64aeb030a5", "server":"6183", "farm":7, "title":"Civil unrest artist", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6016220539", "owner":"37216036@N05", "secret":"a0c005a284", "server":"6143", "farm":7, "title":"Two Brothers", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6016217423", "owner":"37216036@N05", "secret":"59cebc8a4d", "server":"6144", "farm":7, "title":"Lighting the candles", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6016770946", "owner":"37216036@N05", "secret":"97ff738c48", "server":"6009", "farm":7, "title":"Birthday Cake", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"6002573862", "owner":"62890576@N07", "secret":"c55c7644aa", "server":"6125", "farm":7, "title":"I have the best aunts on this earth, it's through them I have learned to laugh often", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5993070040", "owner":"13388507@N03", "secret":"9e526e3327", "server":"6130", "farm":7, "title":"chuck-berry", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5988218514", "owner":"33052567@N00", "secret":"1a87467bb7", "server":"6131", "farm":7, "title":"Octogenarian Paintballing", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5968620942", "owner":"7327650@N07", "secret":"76983c22c9", "server":"6029", "farm":7, "title":"IMG_2251", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5909331911", "owner":"21437618@N02", "secret":"42b0df2fdd", "server":"6053", "farm":7, "title":"Mr Fensom's Foden", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5894465383", "owner":"60261390@N00", "secret":"3e4075d894", "server":"5038", "farm":6, "title":"Sonny", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5888287182", "owner":"7428687@N03", "secret":"4e60088610", "server":"5263", "farm":6, "title":"Teachers pension demo June 30 2011", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5886175787", "owner":"35857273@N08", "secret":"84eb9a3cd1", "server":"6028", "farm":7, "title":"Old Woman, Chincheros Sunday Market, Cusco, Peru", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5882574995", "owner":"35181773@N05", "secret":"b839d279f4", "server":"5309", "farm":6, "title":"", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5847482021", "owner":"57666733@N05", "secret":"19910e7b1d", "server":"3502", "farm":4, "title":"Old and Young", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5842983818", "owner":"71443419@N00", "secret":"ff3b9f1e43", "server":"3377", "farm":4, "title":"Charlie Boy", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5834572008", "owner":"72432841@N00", "secret":"368afaa795", "server":"3074", "farm":4, "title":"", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5821933820", "owner":"46706798@N03", "secret":"0e7531dc78", "server":"5144", "farm":6, "title":"La Regina dei mari - The Queen of the seas - La Reyna de los mares", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5807602269", "owner":"8519304@N03", "secret":"e18eeaa6f2", "server":"3192", "farm":4, "title":"Modernizing", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5805762490", "owner":"51627569@N02", "secret":"ac82e6b0ba", "server":"3526", "farm":4, "title":"Pump House", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5802179294", "owner":"66422668@N00", "secret":"6605c120a0", "server":"2725", "farm":3, "title":"Kids' \/ Octogenarians' table.", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5784060087", "owner":"31603030@N08", "secret":"aea0ba51ca", "server":"2381", "farm":3, "title":"050526-288105 Ginger McElrath holding letter", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5778332197", "owner":"24304033@N03", "secret":"1e8eff46c7", "server":"3383", "farm":4, "title":"Bobby's Beach surf", "ispublic":1, "isfriend":0, "isfamily":0},
    	{"id":"5768044342", "owner":"55312966@N07", "secret":"dee6587742", "server":"3178", "farm":4, "title":"Final stopping place. It turned out to be the land of octogenarians that pwned the buffet.", "ispublic":1, "isfriend":0, "isfamily":0}
    ]
});

//var flickrurl = escape('http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=92c97f2910c110bcfdc58e8365c86aa4&text=octogenarian&per_page=5&page=1&&format=json&nojsoncallback=1');

//flickrurl = flickrurl.substr(flickrurl.indexOf("["),flickrurl.indexOf("]")-flickrurl.indexOf("[")+1);

sink.Main.onlinestore = new Ext.data.Store({
    model: 'Photo',
    proxy: {
        type: 'scripttag',
        url: escape('http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=92c97f2910c110bcfdc58e8365c86aa4&text=octogenarian&per_page=5&page=1&&format=json&nojsoncallback=1'),
//        url: 'http://query.yahooapis.com/v1/public/yql?format=json&q=' +
//        escape('http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=92c97f2910c110bcfdc58e8365c86aa4&text=octogenarian&per_page=5&page=1&&format=json&nojsoncallback=1'),
//                    escape('select * from flickr.photos.search where text="cats" limit 30'),
        reader: new Ext.data.JsonReader({
            root: 'query.results.photo'
        }),
        timeout: 2000,
        listeners: {
            exception:function () {
                console.log("I think we are offline");
//                Ext.Msg.alert("URL", "http://query.yahooapis.com/v1/public/yql?format=json&q="+escape('select * from flickr.photos.search where text="cats" limit 30'), Ext.emptyFn);
//                Ext.Msg.alert("Offline", "Problem connecting to DLC EMR!", Ext.emptyFn);  //Docujot
            	count = sink.Main.offlinestore.data.items.length;
            	for (i=0;i<count;i++) {
                	ListStoredata = demos.ListStore.data.items[i]
                	patname = ListStoredata.data.lastName+', '+ListStoredata.data.firstName;
                	sink.Main.offlinestore.data.items[i].data.name = patname;
                	sink.Main.offlinestore.data.items[i].data.url = 'http://www.google.com';
//                    console.log("i="+i+", patname="+sink.Main.offlinestore.data.items[i].data.name);
//                    var photo = sink.Main.offlinestore.add(record.data)[0];
//                    photo.setUrl();
//                    console.log(name+'::'+url);
            	};
//                sink.Main.offlinestore.sync();

                demos.Patientslist.bindStore(sink.Main.offlinestore);
                sink.Main.offlinestore.load();
                }
            }
        }
    });

